"""
@Project:${2108a 人工智能}
@File:tasks.py
@Author:周家昌
@Date:10:26
"""
# 此处定义任务

from ronglian_sms_sdk import SmsSDK
from celery_tasks import celery_app
import json

@celery_app.task()
def sms_code(mobile,code,expire=10):
    sms_sdk = SmsSDK(accId='8aaf07087f77bf96017fddbe402132f5',appId='8aaf07087f77bf96017fddbe412132fd',
                     accToken='d8bb5d0fead14fbd94fb3af1892aff3e')
    tid = '1'
    datas = ('%s'%code,'%s'%expire)
    res = sms_sdk.sendMessage(tid=tid,mobile=mobile,datas=datas)
    res = json.loads(res)
    print(res)
    return res

# celery -A celery_tasks worker -l info -P eventlet
# celery -A celery_tasks worker -l info
# celery multi start -A celery_tasks worker -l info